*Do File for "Favoring Co-Partisan Controlled Areas in Central Government Distributive Programs: The Role of Local Party Organizations"

*Please use Favoring Co-Partisans Dataset.dta (saved in Stata Version 15)

*Please contact authors for more information about data as well as using data 

*rdrobust, rdplot and outreg2 packages need to be installed first

*PC_R&R

*Table 1 - Descriptive statistics
sum yesilkartpooled forcingpooled populationpooled if populationpoole~=. & forcingpooled~=.
sum avgreencard04_07 avgreencard07_09 if duplicate==1 & populationpooled~=. & forcingpooled~=.
sum avgreencard09  if duplicate==1 & forcingpooled~=. & akpm_compshare_rd2>0 & populationpooled~=.

*Table 2 - Number of Green Cards
rdrobust yesilkartpooled forcingpooled, all covs(populationpooled)

*Figure 1
rdplot yesilkartpooled forcingpooled, all covs(populationpooled) graph_options(title() xtitle(Electoral Margin) ytitle(Number of Green Card Holders))

*Table 3 - Time periods
rdrobust avgreencard04_07 forcingpooled if duplicate==1, all covs(populationpooled)
rdrobust avgreencard07_09 forcingpooled if duplicate==1, all covs(populationpooled)
rdrobust avgreencard09 forcingpooled if duplicate==1 & akpm_compshare_rd2>0, all covs(populationpooled)

*Table 4 - Cancellations
rdrobust iptalspooled2 forcingpooled, all covs(populationpooled)
rdrobust iptaldif20096 forcingpooled if duplicate==1, all covs(populationpooled)
rdrobust iptaldif200119 forcingpooled if duplicate==0 & m_rdcomp_2004<0, all covs(populationpooled)


*Online Appendix

*New Green Cards
rdrobust dif forcingpooled if duplicate==1, all covs(populationpooled)
sum dif if duplicate==1 & nouniedushare~=. & forcingpooled~=. & voterspooled2~=.

*Tests of no-discontinuity
rdrobust voterspooled2 forcingpooled if nouniedushare~=., all 
rdrobust populationpooled forcingpooled if nouniedushare~=., all
rdrobust nouniedushare forcingpooled if nouniedushare~=., all
rdrobust subehaz2011a forcingpooled if nouniedushare~=., all
rdrobust dev_group forcingpooled if nouniedushare~=., all 
rdrobust dev_group forcingpooled if duplicate==1, all 
rdrobust dev_group forcingpooled if duplicate==0, all 

*Tests of no-discontinuity - 2009
rdrobust voterspooled2 forcingpooled if duplicate==0 & nouniedushare~=., all 
rdrobust populationpooled forcingpooled if duplicate==0 & nouniedushare~=., all
rdrobust nouniedushare forcingpooled if duplicate==0 & nouniedushare~=., all 

*Descriptive statistics - socio-economic variables
sum voterspooled2 nouniedushare subehaz2011a dev_group southeast if nouniedushare~=. & forcingpooled~=.

*robustness to 2004
rdrobust yesilkartpooled forcingpooled if duplicate==1, all covs(populationpooled)
rdrobust yesilkartpooled forcingpooled if duplicate==1, h(6) covs(populationpooled)

*OLS estimates
*change directory first for the outreg command
cd C:\data 
regress yesilkartpooled akpcontrol, robust
outreg2 using gcols, bdec(3) excel replace label
regress yesilkartpooled akpcontrol populationpooled, robust
outreg2 using gcols, bdec(3) excel append label
regress yesilkartpooled akpcontrol populationpooled forcingpooled, robust
outreg2 using gcols, bdec(3) excel append label
regress yesilkartpooled akpcontrol populationpooled forcingpooled nouniedushare dev_group subehaz2011a, robust
outreg2 using gcols, bdec(3) excel append label
regress yesilkartpooled akpcontrol populationpooled nouniedushare subehaz2011a forcingpooled dev_group kurdishper southeast, robust
outreg2 using gcols, bdec(3) excel append label

*Robustness to proportion
gen yesilkartpooledpercapita=yesilkartpooled/populationpooled
rdrobust yesilkartpooledpercapita forcingpooled, all
rdrobust yesilkartpooledpercapita forcingpooled, all covs(southeast)
sum yesilkartpooledpercapita if forcingpooled~=.

*Robusteness to no covariates
rdrobust yesilkartpooled forcingpooled, all 

*Robusteness to including other socio-economic indicators
rdrobust yesilkartpooled forcingpooled, all covs(populationpooled southeast duplicate)
rdrobust yesilkartpooled forcingpooled, all covs(populationpooled southeast duplicate nouniedushare)
rdrobust yesilkartperpop forcingpooled, all covs(southeast)
rdrobust yesilkartperpop forcingpooled, all covs(southeast duplicate)
rdrobust yesilkartpooled forcingpooled if duplicate==1, all covs(populationpooled nouniedushare southeast)
rdrobust yesilkartpooled forcingpooled if duplicate==1, all covs(populationpooled dev_group southeast)
rdrobust yesilkartpooled forcingpooled if duplicate==1, all covs(populationpooled dev_group)
rdrobust yesilkartpooled forcingpooled if duplicate==1, all covs(populationpooled southeast)

*Graphical analysis
rdplot yesilkartpooled forcingpooled if forcingpooled>-50 & forcingpooled<50, all ci(95) shade

*Descriptive statistics - cancellations
sum iptalspooled2 if populationpooled~=. & forcingpooled~=.
sum iptaldif20096 iptaldif20076 if duplicate==1 & nouniedushare~=. & forcingpooled~=. & voterspooled2~=.
sum iptaldif200119 if duplicate==0 & forcingpooled~=. & populationpooled~=.

*Alternative analysis of cancellation
rdrobust iptalspooled3 forcingpooled, all covs(populationpooled)

*Cancellations 2006-2007, 2007-2009
rdrobust iptaldif20076 forcingpooled if duplicate==1, all covs(populationpooled)
rdrobust iptaldif20097 forcingpooled if duplicate==1, all covs(populationpooled)


